<template>
  <panel>

    <el-row class="operate-wrap">
      <el-col :span="30">
        <el-button type="info" size="small" @click="editForm">保存</el-button>
        <el-button size="small" @click="cancelForm">取消</el-button>
      </el-col>
    </el-row>


      <el-tabs v-model="activeName" type="border-card">
        <el-tab-pane label="结构信息" name="first">

          <h3 class="mt24" style="text-align:left">基础信息</h3>
          <el-row>
            <el-col :span="24" class="form-wrap">
              <el-form :model="ruleForm"  ref="ruleForm" label-width="100px" :label-position="'left'">

                <el-form-item label="分期备案名" prop="caseName" class="item-5">
                  <el-input v-model="ruleForm.caseName" size="small" ></el-input>
                </el-form-item>
                <el-form-item label="类型" prop="type" class="item-5">
                  <el-input v-model="ruleForm.type" size="small" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="编码" prop="number" class="item-5">
                  <el-input v-model="ruleForm.number" size="small" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="工程名称" prop="name" class="item-5">
                  <el-input v-model="ruleForm.name" size="small" :disabled="true"></el-input>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>

          <h3 class="mt24" style="text-align:left">属性信息</h3>
          <el-row>
            <el-col :span="24" class="form-wrap">
              <el-form :model="ruleForm"  ref="ruleForm" label-width="100px" :label-position="'left'">
                <el-form-item label="税收征收方式" prop="taxName" class="item-5">
                  <el-input v-model="ruleForm.taxName" size="small" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="项目类型" prop="projectTypeName" class="item-5">
                  <el-input v-model="ruleForm.projectTypeName" size="small" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="审批状态" prop="approveStatusName" class="item-5">
                  <el-input v-model="ruleForm.approveStatusName" size="small" :disabled="true"></el-input>
                </el-form-item>
                <el-form-item label="开发状态" prop="develomentStatusName" class="item-5">
                  <el-input v-model="ruleForm.develomentStatusName" size="small" :disabled="true" ></el-input>
                </el-form-item>
              </el-form>
            </el-col>
          </el-row>

        </el-tab-pane>

        <el-tab-pane label="产品业态" name="second">






        </el-tab-pane>
      </el-tabs>




  </panel>

</template>


<script>


  import {queryWBSitemByNumber,editWBSitemByNumber} from "@/api/house";

  export default {

    data() {
      return {


        ruleForm: {
          id:'',
          caseName:'',
          type:'',
          number:'',
          name:'',
          taxCollectionMethods:'',
          projectTypes:'',
          approveStatus:'',
          developmentStatus:'',
          taxName:'',
          projectTypeName:'',
          develomentStatusName:'',
          approveStatusName:'',
        },

        /**
         * 选项卡
         */
        activeName:'first',


      }
    },


    mounted:function(){
      //初始化分期详细信息
      this.initForm();
    },


    methods: {


      /**
       * 编辑项目详细信息
       */
      editForm(){
        const _this = this;
        if(_this.activeName=="first") {
          if (_this.ruleForm.caseName==''||_this.ruleForm.caseName == undefined) {
            _this.$message('分期备案名为空!');
          } else {
            let id = _this.ruleForm.id;
            let obj = {
              "wbsitem": {
                "caseName": _this.ruleForm.caseName,
                "id": id,
              }
            };
            editWBSitemByNumber(obj).then((res) => {
              if (res != null) {
                _this.$message('修改成功!');
                _this.$router.push({path: '/house/info'});
             }
            }).catch(function (error) {
             _this.$message('保存失败!');
           });
          }
        }
      },


      /**
       * 取消跳转到项目信息页面
       */
      cancelForm(){
        this.$router.push({path: '/house/info'});
      },


      /**
       * 初始化分期信息明细
       */
      initForm(){
        const _this = this;
        let id = 'xxxx.0001'
        let obj = {
          "position": "house_queryWBSitemByNumber",
          "paramMap": {
            "number": "xxxx.0001"
          }
        };
        queryWBSitemByNumber(obj).then((res) => {
          if(res[0]!=undefined||res==null) {
            _this.ruleForm = res[0];
            _this.ruleForm.type="分期";
          }
        })
      }





    }
  }
</script>

<style>

</style>
